All Questions
35 questions
12votes
1answer
1kviews
Is "ROW_NUMBER() OVER(ORDER BY xml.node)" well defined?
(It is more a question of documentation rather than behavior. It has been migrated from Stack overflow as was suggested there.) While researching the answer to another question that required ...
2votes
1answer
373views
Converting VARCHAR to XML with a size restriction
I have a query that needs to return text as valid XML. I also need to restrict the length of the text to a specific number of characters. I adapted a function that performs the conversion and outputs ...
1vote
1answer
74views
How to get more then one concatenated column from table rows
Below is a code i use now. In real life @stab table is big (and it is normal table not variable) and there are many concatenated columns, not only 2. I wonder is there any better solution than I use ...
0votes
1answer
94views
Do we have information about duration time of query in actual execution plan?
I am building application in C# which is parsing Actual Execution Plan. I need basic stats like Row count, CPU time, Page Reads etc. All above stats I found in XML of Actual Execution Plan. I can not ...
1vote
3answers
941views
How can parse column names using ordinal position (not name) from XML data in SQL Server?
I have several hundred tables in a database that have the same structure: SomeId, Pos, Varying Number of Other Fields So, for example, one table may look like this: PersonId, Pos, Hobby, Degree 12345, ...
9votes
2answers
415views
Why is SQL doing an index scan and seek with the same XML query structure?
I've set up a test to benchmark xml performance in SQL server. Test Setup One Million rows of data XML defined Column with primary key A primary XML index A secondary XML index on the path XML data ...
1vote
1answer
500views
Querying XML Nodes with SQL
I think I'm nearly there with this but have reached an impasse! I've a relatively straightforward XML structure that I need to parse out as a SQL resultset but can't seem to get it to work. Here is ...
4votes
1answer
430views
T-SQL LIKE Predicate failed to match with whitespace in XML converted varchar
Recently I attempt to search for a particular pattern by converting XML data into varchar(max) although I'm aware it's not the best practice and found out it's not working as expected:- Setup ...
1vote
1answer
62views
Update badly formed XML to allow parsing
I have inherited a production system that needs some fine tuning to enable easy extract of the result set. A record gets added to a table which contains an XML field, with contents similar to the ...
1vote
1answer
6kviews
How to update xml using value from a sql query
I have a table with an XML column. I need to insert various nodes and then set those nodes using values from a sub-query. Setup: use tempdb CREATE TABLE [dbo].[Sites]( [SiteID] [int] IDENTITY(...
0votes
1answer
70views
Loading XML to table producing nothing
I'm trying to import part of an xml file into a SQL Server database, but while the query successfully executes there is nothing in the table. XML: <?xml version="1.0" encoding="utf-16"?> <...
0votes
1answer
48views
MAX Query returns set results when using dbmail
I am setting up alerts in a system and I want to query a db table and get the max date passed in to a data row and only that one entry. For some reason, when I do it, the HTML email that comes ...
2votes
2answers
13kviews
Extract data from an xml fragment
In SQL Server 2014, I have the following xml fragment : <salesorder> <ordnum>123</ordnum> <orddate>2017-04-17</orddate> <details> <detail> ...
11votes
2answers
5kviews
How To Read HTML code as XML and get the output like the sample in sql?
I have HTML code stored in the data base, and I want to read it as XML. My codes: http://rextester.com/RMEHO89992 This is an example of the HTML code I have: <div> <section> &...
8votes
1answer
2kviews
Determine the PackageFormatVersion for multiple .DTSX packages files in a folder
Kenneth Fisher put a blog post out about how to determine What SQL Version is My SSIS Package? in April, 2015. It has a table of which SQL versions map to which PackageFormatVersion of the SSIS ...